<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        //新增数组元素
        var arr1 = ['red','blue','yellow'];
        arr1[3] = 'green';
        console.log(arr1);

        //修改数组元素
        var arr2 = ['red','blue','yellow'];
        arr2[0] = 'pink';
        console.log(arr2);
    </script>
</head>
<body>
    
</body>
</html>